<?php

include "Connect.php";

$delUser = $_POST['delUser'];

$title = $_POST['title'];
$FName = trim(ucfirst($_POST['FName']));
$LName = trim(ucfirst($_POST['LName']));
$UName = trim(ucfirst($_POST['UName']));
$Pass = trim($_POST['Pass']);

if(isset($delUser)){
if($title =="---Select Category---" || $FName == "" || $LName == "" || $UName == "" || $Pass == ""){
$msg3 =  "Please avail all fields correctly to delete user details";
header("location:users.php?poll3=$msg3");
}else{

$query = mysql_query("DELETE FROM workers WHERE Responsibility = '$title' and Username = '$UName' ") or die(mysql_error());
if($query){
$msg3 =  $title." with user name ".$UName." deleted successfully";
header("location:users.php?poll3=$msg3");
}else{
$msg3 =  "Deletion failed, please try again!!";
header("location:users.php?poll3=$msg3");
}
  }
}
?>